#!/bin/bash

echo EXPORTS > cxcore.def
nm /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/lib/cxcore.lib | grep ' T _' | sed 's/.* T _//' >> cxcore.def
dlltool --def cxcore.def --dllname cxcore110.dll --output-lib libcxcore.dll.a

echo EXPORTS > cv.def
nm /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/lib/cv.lib | grep ' T _' | sed 's/.* T _//' >> cv.def
dlltool --def cv.def --dllname cv110.dll --output-lib libcv.dll.a

echo EXPORTS > cvaux.def
nm /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/lib/cvaux.lib | grep ' T _' | sed 's/.* T _//' >> cvaux.def
dlltool --def cvaux.def --dllname cvaux110.dll --output-lib libcvaux.dll.a
 
echo EXPORTS > highgui.def
nm /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/lib/highgui.lib | grep ' T _' | sed 's/.* T _//' >> highgui.def
dlltool --def highgui.def --dllname highgui110.dll --output-lib libhighgui.dll.a

cp lib*.a /usr/lib

cp /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/bin/cxcore110.dll /usr/bin
cp /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/bin/cv110.dll /usr/bin
cp /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/bin/cvaux110.dll /usr/bin
cp /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/bin/highgui110.dll /usr/bin

mkdir /usr/include/opencv
cp /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/cxcore/include/*.h* /usr/include/opencv
cp /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/cv/include/*.h* /usr/include/opencv
cp /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/cvaux/include/*.h /usr/include/opencv
cp /cygdrive/C/Program\ Files\ \(x86\)/OpenCV/otherlibs/highgui/*.h* /usr/include/opencv

